<!-- BEGIN: PAGECONTENT -->
        <script type="text/javascript">
			$(document).ready(function() {
			    //validate signup form on keyup and submit
			    $("#admin_form").validate({
			        rules: {
			            Title: {
			                required: true,
			                maxlength: 70
			            }
			        },
			        messages: {
			            Title: {
			                required: "Tiêu đề không được phép để chống",
			                maxlength: "Tiêu đề không nên dài quá 70 ký tự"
			            }
			        }
			    });
			    
			    // Initialise FancyBox Modal window:
			    $("a.fancy").fancybox({
			        'titlePosition' : 'inside'
			    });
			    
			 	// set file type
			    //setFileType();
			    
			    $('#ImageLink').change(function() {
			    	setFileType();
		    	});
			});
		</script>
		<style type="text/css">
		    #admin_form label.error { width: 100%; color:red; margin-top:5px;}
		</style>
        <script type="text/javascript">
            function BrowseServer()
            {
                var finder = new CKFinder();
                finder.basePath = 'files/';
                finder.selectActionFunction = SetFileField;
                finder.popup();
            }
            
         	// This is a sample function which is called when a file is selected in CKFinder.
            function SetFileField( fileUrl )
            {
            	$("#Link").val(fileUrl);
            	setFileType();
            }
			
            function setFileType(){
            	var link = $("#Link").val();
            	var fileType = link.split(".");
            	fileType = fileType[fileType.length - 1];
            	
            	if (fileType.length > 0 && fileType == "doc"){
            		$('div#over-view').html("<img src=\"content/site/images/icons/finefiles/64/word.png\" id=\"upload-img\" style=\"max-height: 250px;\">");
            	} else if (fileType.length > 0 && fileType == "docx"){
            		$('div#over-view').html("<img src=\"content/site/images/icons/finefiles/64/word.png\" id=\"upload-img\" style=\"max-height: 250px;\">");
            	} else if (fileType.length > 0 && fileType == "xlsx"){
            		$('div#over-view').html("<img src=\"content/site/images/icons/finefiles/64/excel.png\" id=\"upload-img\" style=\"max-height: 250px;\">");
            	} else if (fileType.length > 0 && fileType == "xls"){
            		$('div#over-view').html("<img src=\"content/site/images/icons/finefiles/64/excel.png\" id=\"upload-img\" style=\"max-height: 250px;\">");
            	} else if (fileType.length > 0 && fileType == "txt"){
            		$('div#over-view').html("<img src=\"content/site/images/icons/finefiles/64/text.png\" id=\"upload-img\" style=\"max-height: 250px;\">");
            	} else if (fileType.length > 0 && fileType == "rtf"){
            		$('div#over-view').html("<img src=\"content/site/images/icons/finefiles/64/rtf.png\" id=\"upload-img\" style=\"max-height: 250px;\">");
            	} else if (fileType.length > 0 && fileType == "ttf"){
            		$('div#over-view').html("<img src=\"content/site/images/icons/finefiles/64/ttf.png\" id=\"upload-img\" style=\"max-height: 250px;\">");
            	} else if (fileType.length > 0 && fileType == "pdf"){
            		$('div#over-view').html("<img src=\"content/site/images/icons/finefiles/64/pdf.png\" id=\"upload-img\" style=\"max-height: 250px;\">");
            	} else {
            		$('div#over-view').html("<img src=\"content/site/images/icons/finefiles/64/chm.png\" id=\"upload-img\" style=\"max-height: 250px;\">");
            	}
            }
        </script>
        <div class="form-content-page">
            <section>
			        <form class="block-content form" id="admin_form" method="post" action="submit.php?ctrl={CONTROLLER}&act={ACTION}">
			            <h2>{FORMTITLE}</h2>
			            <!-- BEGIN: ITEM -->
			            <fieldset>
			                <legend>
			                    Nội dung danh mục
			                </legend>
			                <input type="hidden" name="ID" id="ID" value="{ITEM.ID}">
			                <div class="columns">
                                <div class="colx2-left">
                                 	<p>
					                    <label for="Title">Tiêu đề:</label>
					                    <input type="text" name="Title" id="Title" value="{ITEM.Title}" class="full-width">
					                </p>
					                <p>
					                    <label for="Type">Danh Mục:</label>
					                    {ITEM.CategoryID}
					                </p>
                                </div>
                                <div class="colx2-right">
                                	<div class="imageBox">
		                                <label for="ImageLink">Đường dẫn file:</label>
		                                <div style="width: 100%" align="center" id="over-view">
			                               <img src="content/site/images/icons/finefiles/64/chm.png" style="max-height: 250px;"></a>
			                            </div>
			                            <br /> 
		                                <input type="text" name="Link" id="Link" value="{ITEM.Link}" class="half-width">
		                                &nbsp;&nbsp; <button type="button" class="grey browser-file" onclick="BrowseServer();">Chọn file</button>
		                            </div>
                                </div>
                            </div>
			            </fieldset>
			            <fieldset class="grey-bg no-margin">
			                <p class="input-with-button" align="center">
			                    <button type="submit">
			                        Hoàn thành
			                    </button>
			                    <a href="maincontent.php?ctrl={CONTROLLER}&act=view-table&cid={CID}"> 
				                    <button type="button">
		                                Hủy bỏ
		                            </button> 
	                            </a>
			                </p>
			            </fieldset>
			            <!-- BEGIN: ITEM -->
			        </form>
			</section>
        </div>
<!-- END: PAGECONTENT -->